package com.ty.day4;

import java.util.HashSet;
import java.util.Iterator;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/27 16:30
 */
public class SetDemo02 {
    public static void main(String[] args) {
        HashSet<String> set = new HashSet<>();
        set.add("唐小宇");
        set.add("居居波");
        set.add("吉儿阳");
        set.add("土豆丝");
        set.add("冲击波");
        set.forEach((x)->{
            System.out.println(x);
        });
        System.out.println("~~~~~~");
        for (String s : set) {
            System.out.println(s);
        }
        System.out.println("~~~~~~");
        Iterator<String> iterator = set.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
    }
}
